/*NOTICE

This software was produced for the U. S. Government
under Contract No. FA8721-09-C-0002, and is
subject to the Rights in Noncommercial Computer Software
and Noncommercial Computer Software Documentation Clause
(DFARS) 252.227-7014 (JUN 1995)

(c) 2009 The MITRE Corporation. All Rights Reserved.
*/
package org.mitre.xmltransform;

import javax.xml.namespace.QName;
import javax.xml.xpath.XPathVariableResolver;
import java.util.*;

public class XPathVariableResolverImpl implements XPathVariableResolver {
	public XPathVariableResolverImpl() {
		mVariables = new HashMap<String,String>();
	}
	public Object resolveVariable(QName variableName) {
		if (variableName == null) throw new NullPointerException("null variable name passed to XPath variable resolver.");
		return mVariables.get(variableName.toString());
	}
	
	public void setVariable(String pName, String pValue) {
		mVariables.put(pName, pValue);
	}
	
	public void reset() {
		mVariables.clear();
	}

	private Map<String, String> mVariables;
}
